class GoodsModel {
  int? id;
  int? categoryId;
  String? name;
  String? goodsSn;
  double? marketPrice;
  double? shopPrice;
  String? goodsBrief;
  bool? shipFree;
  String? goodsFrontImage;
  Category? category;
  Category? brand;

  GoodsModel(
      {this.id,
        this.categoryId,
        this.name,
        this.goodsSn,
        this.marketPrice,
        this.shopPrice,
        this.goodsBrief,
        this.shipFree,
        this.goodsFrontImage,
        this.category,
        this.brand});

  GoodsModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    categoryId = json['categoryId'];
    name = json['name'];
    goodsSn = json['goodsSn'];
    marketPrice = json['marketPrice'];
    shopPrice = json['shopPrice'];
    goodsBrief = json['goodsBrief'];
    shipFree = json['shipFree'];
    goodsFrontImage = json['goodsFrontImage'];
    category = json['category'] != null
        ? new Category.fromJson(json['category'])
        : null;
    brand = json['brand'] != null ? new Category.fromJson(json['brand']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['categoryId'] = this.categoryId;
    data['name'] = this.name;
    data['goodsSn'] = this.goodsSn;
    data['marketPrice'] = this.marketPrice;
    data['shopPrice'] = this.shopPrice;
    data['goodsBrief'] = this.goodsBrief;
    data['shipFree'] = this.shipFree;
    data['goodsFrontImage'] = this.goodsFrontImage;
    if (this.category != null) {
      data['category'] = this.category!.toJson();
    }
    if (this.brand != null) {
      data['brand'] = this.brand!.toJson();
    }
    return data;
  }
}

class Category {
  int? id;
  String? name;

  Category({this.id, this.name});

  Category.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    return data;
  }
}
